#include<iostream>
using namespace std;

long long factorial_sum(int n){
    long long sum = 0;
    long long factorial = 1;

    for(int i=1 ; i<=n ;i++){
        factorial *= i;
        sum += factorial;
    }
    return sum;
}
int main(){
    int n;
    cout<<"请输入正整数n：";
    cin>>n;

    long long result = factorial_sum(n);
    cout<<"1!+2!+3!+...+"<<n<<"!="<<result<<endl;

    system("pause");
    return 0;
}